Skip to content
This repository has been archived by the owner on Sep 1, 2020. It is now read-only.

Latest commit

 

History

History
15 lines (10 loc) · 668 Bytes

7.2.2 - Http/Request->$server.md

File metadata and controls

15 lines (10 loc) · 668 Bytes

Http\Request->$server

Http请求相关的服务器信息,相当于PHP$_SERVER数组。包含了Http请求的方法,URL路径,客户端IP等信息。

echo $request->server['request_time'];
  • 数组的key全部为小写,并且与PHP$_SERVER数组保持一致

request_time

request_time是在Worker设置的,在SWOOLE_PROCESS模式下存在dispatch过程,因此可能会与实际收包时间存在偏差。尤其是当请求量超过服务器处理能力时,request_time可能远滞后于实际收包时间。

可以通过$server->getClientInfo方法获取last_time获得准确的收包时间。